package com.wbs.shop.nuby.api;


import com.alibaba.fastjson.JSONObject;
import com.wbs.shop.nuby.bean.EmployeeBean;
import com.wbs.shop.nuby.bean.GoodsBean;
import com.wbs.shop.nuby.bean.ResultBean;
import com.wbs.shop.nuby.bean.ShopMemberBean;
import com.wbs.shop.nuby.bean.UnderLineOrderBean;

import java.util.List;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Query;

/**
 * Created by zhoucl
 * Description: 所有请求接口定义
 */
public interface ApiService {
    /**
     * jsonParam	String 查询条件
     * pageNo	Integer 页码
     * pageSize	Integer 页数大小
     * jsonParam 字段	类型	描述
     * name	String 商品名称查询
     * agent	String 0自营商品 1 代销商品
     */
    @POST("/api/shop/auth/getGoodsList")
    @FormUrlEncoded
    Observable<ResultBean<List<GoodsBean>>> getGoodsList(@Field("jsonParam") String jsonParam,
                                                         @Field("pageNo") int pageNo);

    /**
     * id	String 商品id
     */
    @POST("/api/shop/auth/getGoodsDetail")
    @FormUrlEncoded
    Observable<ResultBean<GoodsBean>> getGoodsDetail(@Field("id") int id);

    /**
     * mobile	String 输入手机号码
     * isPreview	String 1预览 0 提交订单
     * pinfo	String 购物车信息：[{specId:'',goodsId:'',quantity:1}]
     */
    @POST("/api/shop/auth/buyOrderForOffLine")
    @FormUrlEncoded
    Observable<ResultBean<UnderLineOrderBean>> buyOrderForOffLine(@Field("mobile") String mobile,
                                                                  @Field("isPreview") int isPreview,
                                                                  @Field("empId") Integer empId,
                                                                  @Field("offLineDerateVprice") String offLineDerateVprice,
                                                                  @Field("pinfo") String pinfo);

    @GET("/api/store/auth/regAccount")
    Observable<ResultBean<ShopMemberBean>> regAccount(@Query("mobile") String mobile,
                                                      @Query("shopId") String shopId);

    /**
     * 前端收银_支付
     * payCode	String 支付编码，保存订单接口返回
     * authCode 可选	String 条码授权编号,微信支付宝扫描返回的码
     * payMode	String 0微信支付 2支付宝 3余额
     */
    @POST("/api/shop/auth/payUnderLineOrder")
    @FormUrlEncoded
    Observable<ResultBean<JSONObject>> payUnderLineOrder(@Field("payCode") String payCode,
                                                         @Field("authCode") String authCode,
                                                         @Field("payMode") int payMode);

    /**
     * 前端收银_员工列表
     */
    @GET("/api/shop/auth/shopUserList")
    Observable<ResultBean<List<EmployeeBean>>> shopUserList();

    @GET("/api/admin/common/getUpdateApp")
    Observable<ResultBean<JSONObject>> version();

    @POST("/upload")
    @Multipart
    Observable<ResultBean<String>> doFileUpload(@Part List<MultipartBody.Part> partList);

}





